﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using PeekService;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace PeekWebApp
{
    /// <summary>
    /// infohandler 的摘要说明
    /// </summary>
    public class infohandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string typeId = context.Request["ti"];
            string regionId = context.Request["ri"];
            int psize = int.Parse(context.Request["pz"]);
            int pindex = int.Parse(context.Request["pi"]);
            int recordCount=0;
            List<TourInfoModel> list = new ExtendService().GetAllByTypeRegion(pindex, psize, out recordCount, typeId, regionId,"","","");
            context.Response.Write(JsonConvert.SerializeObject(new { pager = new { psize=psize,pindex=pindex,pcount=recordCount} ,data=list}));
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}